home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / VISUAL_B / H441.ZIP / VXBTEST.ZIP / VXFORM3.FRM (.txt) < prev    next >
Visual Basic Form  |  1992-12-08  |  26KB  |  605 lines

  1. VXFORM3
  2. Aircraft Brokerage Customers
  3. Form1%
  4. CustStatus
  5. CustExit
  6. E&xit
  7. CustBrowse
  8. &Browse
  9. CustPrevious
  10.     &Previous
  11. CustNext
  12. &Next
  13. CustMemo
  14. &Memo
  15. CustDelete
  16. &Delete
  17. CustAdd
  18. CustCancel
  19. &Cancel
  20. CustSave
  21. &Save
  22. G    CustRdate
  23. MS Serif
  24. Aircraft
  25.     Ai&rcraft
  26. MS Serif
  27. CustDays
  28. MS Serif
  29. F    CustCdate
  30. MS Serif
  31. Picture1
  32. CustSeller
  33. Seller
  34. MS Serif
  35. 9    CustBuyer
  36. Buyer
  37. MS Serif
  38. BuyRecs
  39.     Bu&y Recs
  40. MS Serif
  41. CustFax
  42. MS Serif
  43. D    CustPhBus
  44. MS Serif
  45. C    CustPhRes
  46. MS Serif
  47. CustZip
  48. MS Serif
  49. CustStateHelp
  50. MS Serif
  51. A    CustState
  52. MS Serif
  53. CustCity
  54. MS Serif
  55. CustAddress
  56. MS Serif
  57. CustCompany
  58. MS Serif
  59. CustName
  60. MS Serif
  61. CustCode
  62. MS Serif
  63. Label14
  64. Status
  65. MS Serif
  66. Label13
  67. Revised
  68. MS Serif
  69. Label12
  70. Days on File
  71. MS Serif
  72. Label11
  73. Created
  74. MS Serif
  75. Label10
  76. MS Serif
  77. Label9
  78.     Bus Phone
  79. MS Serif
  80. Label8
  81.     Res Phone
  82. MS Serif
  83. Label7
  84. MS Serif
  85. Label6
  86. State
  87. MS Serif
  88. Label5
  89. MS Serif
  90. Label4
  91. Address
  92. MS Serif
  93. Label3
  94. Company
  95. MS Serif
  96. Label2
  97. Last Name, First Name
  98. MS Serif
  99. Label1
  100. MS Serif
  101.     Form_LoadX
  102. vxSelectDbf
  103. AircustDbf
  104. Form3ActiveG
  105. CustReturn1
  106. BROWSE_ADD6
  107. CustDataClear
  108. CustStatus
  109. Text(
  110. CustSave
  111. Enabled
  112. CustCancel
  113. CustMemoJ
  114. FALSEh
  115. CustAddM
  116. CustDeleteY
  117. BuyRecsU
  118. aircraft
  119. CustCode
  120. BROWSE_EDIT
  121. CustDataLoad
  122. vxTrue
  123. vxRecNo
  124. CustName
  125. CustCompany
  126. CustAddress
  127. CustCity$
  128.     CustState
  129. CustZip
  130.     CustPhRes>
  131.     CustPhBus
  132. CustFax
  133.     CustBuyer
  134. Value6
  135. CustSeller1
  136.     CustCdateO
  137.     CustRdate
  138. CustDaysX
  139. CursorWaitj
  140. EnableCustDatac
  141. vxField
  142. DateCreate
  143. vxDateFormat
  144. xDate
  145. DaysOnFiler
  146. vxDateString
  147. VX_AMERICAN
  148. CustKey
  149. vxUnLock
  150. CursorArrow
  151. DisableCustData&
  152. CustCode_GotFocus
  153. vxCtlLengthL
  154. CustCode_KeyPress
  155. KeyAsciip
  156. CustName_KeyPressy
  157. CustCompany_KeyPress
  158. CustAddress_KeyPress
  159. CustCity_KeyPress
  160. CustZip_KeyPress
  161. CustPhRes_KeyPress
  162. CustPhBus_KeyPress
  163. CustFax_KeyPress
  164. CustState_KeyPress%
  165. CustName_GotFocus=
  166. CustAddress_GotFocusR
  167. CustCity_GotFocush
  168. CustState_GotFocus|
  169. CustZip_GotFocus
  170. CustPhRes_GotFocus
  171. CustPhBus_GotFocus
  172. CustFax_GotFocus>
  173. CustSave_Click
  174. SeekKey
  175. EmptyStringa
  176. vxSeek
  177. AirstateDbf~    
  178. vxSelectNtx
  179. Airstat1Ntx*
  180. IsBuyer
  181. IsSellerB
  182. WasBuyer
  183.     WasSellerU
  184. RDatec
  185. CDate
  186. vxAppendBlank0
  187. vxReplString
  188. vxReplDate
  189. vxWriteE
  190.     RecNumber
  191. vxClose(    
  192.     BuyerOpen!
  193. Airbuy1Ntx
  194. vxEof
  195. vxDeleteRec
  196. vxSkip
  197. RecNum
  198. AirbuyerDbf
  199. AircraftOpenr
  200. Aircraf1Ntx
  201. StatesOpen
  202. CustStateHelp_Click
  203. SaveReturn9
  204. BROWSE_USER
  205. Airstat2Ntx
  206. StateReturn
  207. VXFORM3
  208. vxBrowse
  209. CustAdd_Click
  210. CustCancel_Click
  211. CustBrowse_Click7    
  212. Visible
  213. BrowseCust
  214. CustDelete_Click'
  215. CustExit_Click|
  216. CustNext_Click$
  217. CustNexth
  218. CustPrevious
  219. CustBrowse
  220.     vxDeleted
  221. vxBottom
  222. CustPrevious_Click?
  223. vxBof
  224. vxTop
  225. Form_UnloadT    
  226. Cancel
  227. vxWindowDereg
  228. VXFORM1[
  229.     OpenTypes
  230. OpenCust
  231. OpenAircraft
  232. LinkBuyToSell
  233. LinkSellToBuy
  234.     PackFiles
  235. TestCreateK
  236. TestCopyc    
  237. TestDataCopy
  238.     FileStruc~
  239. CustBuyer_KeyPress7
  240. CustSeller_KeyPress
  241. BuyRecs_Click
  242.     TypesOpen
  243. BofExpr
  244. EofExpr
  245. vxTableDeclare
  246. VX_RED
  247. vxTableField
  248. VX_FIELD
  249. VX_EXPR
  250. BuyerRecB    
  251. BrowseBuyers
  252. BuyerReturn
  253. VXFORM4
  254. Aircraft_Clicko    
  255. AircraftDbf
  256. vxUseDbf
  257. AirtypesDbfO
  258. vxUseNtx]
  259. Aircraf2Ntx
  260. AircraftReturn
  261. VXFORM5
  262. CustMemo_Click
  263. vxMemoEdit
  264. Form_Paint
  265. vxFormFrame
  266. vxCtlStyle
  267. VX_RAISE
  268.     VX_RECESS
  269. Picture1
  270. BROWSE_DELETE
  271. CustCompany_GotFocus
  272. vxCloseNtxl
  273. Aircust2Ntx{
  274. Aircust3Ntx
  275. Aircust1Ntx
  276. vxCloseAll
  277. FindWindow
  278. SendMessage
  279. WM_CLOSE
  280. Aircraft_Click
  281.  there is only one aircraft sell record allowed-
  282.  to a customer so this makes it a little simpler
  283.  Close states file to free some handles-
  284.  also does vxTableReset-
  285.  open airtypes file and aircraft file-
  286. \vb\vxbtest\aircraft.dbf
  287. Error Opening aircraft.dbf. Aborting.
  288. \vb\vxbtest\aircraf1.ntx
  289. \vb\vxbtest\aircraf2.ntx
  290. No aircraft records. Add?
  291. BuyRecs_Click
  292.  open airtypes file and buyer file
  293.  Set up browse table limited to buyer records
  294.  that match the CustKey. We do this by sending
  295.  the vxTableDeclare proc a beginning ofs
  296.  file expression and an end of file expression.
  297. b_code < '
  298. b_code > '
  299.  The vxBrowse object now knows to limit the-
  300.  records in the table to those that have b_code
  301.  values equal to CustKey. We also scope the records with the
  302.  "6" following the EofExpr and set the quick key index tot
  303.  "7". An explanation follows:d
  304.  The key we are going to use to browse this file isd
  305.  b_code + b_cat, whose elements are 6 long and 3 long
  306.  respectively.  Every record we are interested in has thet
  307.  same b_code (i.e., they all belong to the same customer).
  308.  Setting the scope index to 6 determines the action to be.
  309.  taken when the HOME or END keys are depressed. The normal
  310.  value is 0, which takes you to the first and last logical
  311.  records in the file when HOME or END is hit. If other than
  312.  zero, then the HOME key will result in a softseek on thea
  313.  file to the current key for the length specified by the
  314.  scope index. The END key will softseek to the current key
  315.  plus 1 and then skip back one record to position thet
  316.  record pointer to the last record in the group.
  317.  The quick index is set to 7, which is the first positiony
  318.  of the aircraft type code in the key. We aren't event
  319.  going to display the b_code for the buyer records. Setting
  320.  the quick index to 7 means that the common part of the key
  321.  for the group of records we are interested in (the firste
  322.  6 which form the customer code), will be prepended to the
  323.  quick keys entered at the keyboard before a seek is donee
  324.  on the file. Makes sense, huh?o
  325.  When scoping a file in this fashion, the only thing you
  326.  MUST do is position the record pointer to the first
  327.  record in the group and then pass that record number
  328.  to the vxBrowse proc (the StartRec& parameter).
  329. b_cat
  330. Description
  331. b_desc
  332. b_low
  333. b_high
  334. STR((b_high / b_low)*100,7,2)
  335.  Because we are interested in only a subset of the possible
  336.  records in the buyer file, we have to determine ourselves
  337.  whether there are any records in the file that match thes
  338.  group. If not, we ask the user if he wants to add a record.
  339.  vxBrowse normally does this, but the file must be empty
  340.  before it asks the question and sets the return value
  341.  accordingly.k
  342.  global var-
  343.  set for browse start rec-
  344. No buyer records. Add?
  345. CustAdd_Click
  346.  clear form for addition of new record
  347. Record Addition Request
  348.  ensure data entry enabled
  349.  reset the buttons
  350. CustAddress_GotFocus
  351. a_address
  352. CustAddress_KeyPress
  353. {Tab}
  354. CustBrowse_Click
  355.  so we don't close files
  356.  when we unload the form
  357. CustBuyer_KeyPress
  358. {Tab}
  359. CustCancel_Click
  360.  Clear form data and reset button status
  361. Operation cancelled
  362.  we must disable data entry because the user
  363.  could enter a new record in the blank boxes
  364.  and then press the Add button. The TypeAdd_Click-
  365.  routine clears the form boxes again prior tol
  366.  accepting input so the user's work would be lost-
  367.  and he would be mad.h
  368. CustCity_GotFocus
  369. a_city
  370. CustCity_KeyPress
  371. {Tab}
  372. CustCode_GotFocus
  373.  set up text length limit-
  374. a_code
  375. CustCode_KeyPress
  376.  Convert customer code to uppercase as it is being entered
  377.  also convert enter key to tab
  378. {Tab}
  379. CustCompany_GotFocus
  380. a_company
  381. CustCompany_KeyPress
  382. {Tab}
  383. CustDataClear
  384.  Clear Form in preparation for add or after successful delete
  385. dd-mmm-yyyy
  386. dd-mmm-yyyy
  387. CustDataLoad
  388.  Load data from customer record
  389.  ensure data entry enabled
  390.  extract field values-
  391. a_code
  392. a_name
  393. a_company
  394. a_address
  395. a_city
  396. a_state
  397. a_zip
  398. a_phoneres
  399. a_phonebus
  400. a_fax
  401.  Return from logical field interrogation
  402.  vxTrue() is -1 (TRUE) or 0 (FALSE).
  403.  By using the unary negation operator
  404.  we will transform any -1 values to the
  405.  checkbox value 1, which means "selected"
  406. a_buyer
  407. a_seller
  408.  vxDateFormat() routine returns a date in the-
  409.  format dd-mmm-
  410. y, which the Visual Basic
  411.  DateValue function inderstands. We will put
  412.  the creation date into a variable so we can
  413.  perform some date arithmetic on it to determine
  414.  the number of days on filei
  415. a_cdate
  416. dd-mmm-yyyy
  417. use the vxDateString function as an example of
  418.  display dates
  419. a_rdate
  420.  set customer key for other links-
  421. CustDelete_Click
  422.  get user confirmation of delete
  423. Confirm Delete
  424.  we must also delete any attached buyer and-
  425.  aircraft recordse
  426.  set global CustKey for links to buyer and aircraft filese
  427.  save record number-
  428.  Close states file to free some handles-
  429.  also does vxTableReset-
  430.  delete buyer recordsv
  431.  in VXBMOD.BAS
  432.  in cust code order-
  433. b_code
  434.  delete aircraft record
  435.  in VXBMOD.BAS
  436.  in cust code order-
  437.  reopen states fileu
  438.  in VXBMOD.BAS
  439.  now delete the requested record
  440.  Deleted
  441. Delete failed
  442. Delete cancelled
  443. CustExit_Click
  444.  current form is unloaded because if needed again
  445.  the form_load proc must be invoked to reset the
  446.  control datad
  447. CustFax_GotFocus
  448. a_fax
  449. CustFax_KeyPress
  450. {Tab}
  451. CustMemo_Click
  452.  Edit memo. Always have an ENABLED form showing to act as-
  453.  parent to the memo window. It also must have the focus.
  454.  Copy the code below EXACTLY to ensure successful memoedits.
  455.  save rec num to goto later-
  456.  make sure form has focus
  457. a_memo
  458.  reset rec buffera
  459.  unlock the record
  460. CustName_GotFocus
  461. a_name
  462. CustName_KeyPress
  463. {Tab}
  464. CustNext_Click
  465.  skip forward one record
  466.  if skip error, only allow exit-
  467. Error on Skip Next. Try Reindex.
  468.  test for end of file 
  469. End of File!
  470. Skipped to record 
  471.  rec unlocked here
  472. CustPhBus_GotFocus
  473. a_phonebus
  474. CustPhBus_KeyPress
  475. {Tab}
  476. CustPhRes_GotFocus
  477. a_phoneres
  478. CustPhRes_KeyPress
  479. {Tab}
  480. CustPrevious_Click
  481.  skip back one recorde
  482.  if skip error, only allow exit
  483. Error on Skip Previous. Try Reindex.
  484.  test for beginning of filer
  485. Beginning of File!
  486. Skipped to record 
  487. CustSave_Click
  488.  Validate data when save button is pressed
  489.  verify something in the field
  490. Field cannot be empty
  491.  verify unique key if adding
  492. Duplicate Key on Add
  493.  verify that state code is in states file-
  494.  on code
  495. State code not found
  496.  set vxbase logical values based on-
  497.  status of check box
  498.  if we're updating a record, save old buyer/seller
  499.  status in case we have to make adjustments to
  500.  the buyer and aircraft files if the status changes
  501. a_buyer
  502. a_seller
  503.  set up date strings in preparation for replace-
  504. dd-mmm-yyyy
  505. dd-mmm-yyyy
  506. a_cdate
  507.  Data passed. Put it away
  508. a_code
  509. a_name
  510. a_company
  511. a_address
  512. a_city
  513. a_state
  514. a_zip
  515. a_phoneres
  516. a_phonebus
  517. a_fax
  518. a_buyer
  519. a_seller
  520. a_cdate
  521. a_rdate
  522.  we might have a new revision date
  523. a_rdate
  524.  Update status box
  525. Record 
  526.  appended
  527. Record 
  528.  saved
  529.  enable/display buyer/aircraft buttons
  530.  set global CustKey for links to buyer and aircraft files
  531.  save record number-
  532.  Close states file to free some handles-
  533.  also does vxTableReset-
  534.  Test old buyer status and remove records from buyer
  535.  file if he is no longer a buyer but once wasm
  536.  in VXBMOD.BAS
  537.  in cust code order-
  538. Confirm delete of existing buyer records
  539. b_code
  540.  if delete denied then reset buyer status to true
  541. a_buyer
  542.  Test old seller status and remove record from aircraft
  543.  file if he is no longer a seller but once was
  544.  in VXBMOD.BAS
  545.  in cust code order-
  546. Confirm delete of existing aircraft record
  547.  if delete denied then reset seller status to true
  548. a_seller
  549.  reopen states file
  550.  in VXBMOD.BAS
  551.  Update Button Status
  552. CustSeller_KeyPress
  553. {Tab}
  554. CustState_GotFocus
  555. a_state
  556. CustState_KeyPress
  557. {Tab}
  558. CustStateHelp_Click
  559.  display a browse window on the state file. If the user
  560.  double clicks a state or presses ENTER on a highlighted
  561.  record, we'll get the record number back and we can
  562.  stuff the state code into CustState.text 
  563.  on state name
  564. State and Provincial Abbreviations
  565.  after a browse, always re-register the database
  566.  with the window with a vxSelectDbf before attemptingA
  567.  to access a field in the help file.
  568. statecode
  569. CustZip_GotFocus
  570. a_zip
  571. CustZip_KeyPress
  572. {Tab}
  573. DisableCustData
  574.  Disables data entry when the cancel button-
  575.  is presseda
  576. EnableCustData
  577.  enables all data entry controls on the form
  578.  which are disabled by the CustCancel_Click Proc
  579. Form_Load
  580.  On form load analyze results of browse return
  581. Record addition request
  582.  if user pressed ENTER then file is positioned
  583.  at current record and the record number isn
  584.  returned in CustReturn. In this case we assume
  585.  he wants to edit that record.
  586.  call general proc to load controls-
  587.  can't change keyt
  588. a_seller
  589. a_buyer
  590. Edit record 
  591. Form_Paint
  592.  sample code that illustrates closing of
  593.  a pick list browse window if the user
  594.  sets the focus back to this form without
  595.  closing the pick list window firsti
  596. State and Provincial Abbreviations
  597.  normal paint procedurev
  598.  if delete request from browse, do it now
  599.  because we must let enhanced controls
  600.  paint before asking for delete confirmation
  601. Form_Unload
  602.  close customer and state files and reset
  603.  table and restart menu window if we'ree
  604.  NOT being unloaded by BrowseCust 
  605.